const getMappedRoutes = (r) => (
  r.map(route => ({
    ...route,
    component: (resolve) => require([`../pages/${route.page}`], resolve),
    children: route.children ? getMappedRoutes(route.children) : undefined
  }))
)

const routes = [{
  path: '/',
  name: '首页',
  page: 'App/App.vue',
  children: [{
    path: '/statistics/consume',
    name: '消费统计',
    page: 'Statistics/Consume.vue',
  }, {
    path: '/statistics/userdata',
    name: '用户统计',
    page: 'Statistics/UserData.vue',
  }, {
    path: '/statistics/methoddata',
    name: '玩法统计',
    page: 'Statistics/MethodData.vue'
  }, {
    path: '/agent/agentquery',
    name: '代理查询',
    page: 'Agent/AgentQuery.vue',
  }, {
    path: '/agent/agentanalyze102',
    name: '销售排行',
    page: 'Agent/AgentAnalyze.vue'
  }, {
    path: '/agent/addagent',
    name: '添加代理',
    page: 'Agent/AddAgent.vue'
  }, {
    path: '/agent/agentranking101',
    name: '销售排行',
    page: 'Agent/AgentRanking.vue'
  }, {
    path: '/agent/agentretrospect101',
    name: '代理追溯',
    page: 'Agent/AgentRetrospect.vue'
  }, {
    path: '/agent/agentwage',
    name: '代理工资',
    page: 'Agent/Wage.vue'
  }, {
    path: '/agent/newagent',
    name: '新增代理',
    page: 'Agent/NewAgent.vue'
  }, {
    path: '/agent/salerank',
    name: '销售排行',
    page: 'Agent/SaleRank.vue'
  }, {
    path: '/agent/agentrank',
    name: '代理排行',
    page: 'Agent/AgentRank.vue'
  }, {
    path: '/salesman/management',
    name: '业务员查询',
    page: 'Salesman/Management.vue',
    meta: {
      icon: 'check'
    },
  }, {
    path: '/salesman/performance',
    name: '业务员业绩',
    page: 'Salesman/Performance.vue',

  }, {
    path: '/player/players',
    name: '玩家查询',
    page: 'Player/Players.vue',
  }, {
    path: '/player/playerstopup',
    name: '充值查询',
    page: 'Player/PlayersTopup.vue',
  }, {
    path: '/player/playerconsume',
    name: '消费查询',
    page: 'Player/PlayerConsume.vue',
  }, {
    path: '/player/ordermanage',
    name: '订单管理',
    page: 'Player/OrderManage.vue',
  }, {
    path: '/player/playerdetails',
    name: '玩家详情',
    page: 'Player/PlayerDetails.vue',
    notinmenu: true // 不在菜单项中显示
  }, {
    path: '/player/playertopup',
    name: '充值记录',
    page: 'Player/PlayerTopup.vue',
    notinmenu: true
  }, {
    path: '/game/announce',
    name: '游戏公告',
    page: 'Game/Announce.vue',
  }, {
    path: '/game/gameroom',
    name: '游戏房间',
    page: 'Game/GameRoom.vue'
  }, {
    path: '/game/roomdetails/:id',
    name: '房间详情',
    page: 'Game/RoomDetails.vue',
    notinmenu: true
  }, {
    path: '/clubs/clubs',
    name: '俱乐部管理',
    page: 'Club/Clubs.vue'
  }, {
    path: '/clubs/clubdetails',
    name: '俱乐部详情',
    page: 'Club/ClubDetails.vue',
    notinmenu: true
  }, {
    path: '/club/playerinfo',
    name: '玩家信息',
    page: 'Club/PlayerInfo.vue',
    notinmenu: true
  }, {
    path: '/auth/password',
    name: '密码管理',
    page: 'Auth/Password.vue'
  }, {
    path: '/auth/role',
    name: '角色管理',
    page: 'Auth/Role.vue'
  }, {
    path: '/auth/user',
    name: '用户管理',
    page: 'Auth/User.vue'
  }, {
    path: '/auth/authconfig/:id',
    name: '权限控制',
    page: 'Auth/AuthConfig.vue',
    notinmenu: true
  }, {
    path: '/activity/eggsmash',
    name: '砸蛋记录',
    page: 'Activity/EggSmash.vue'
  }, {
    path: '/activity/bonusrecord',
    name: '开奖记录',
    page: 'Activity/BonusRecord.vue'
  }, {
    path: '/activity/cardmag',
    name: '卡片管理',
    page: 'Activity/CardMag.vue'
  }, {
    path: '/activity/redpacket',
    name: '红包管理',
    page: 'Activity/RedPacket.vue'
  }, {
    path: '/activity/bonusmag',
    name: '开奖管理',
    page: 'Activity/BonusMag.vue'
  }, {
    path: '/activity/redeemmag',
    name: '兑奖管理',
    page: 'Activity/RedeemMag.vue'
  }, {
    path: '/activity/eggdetail',
    name: '砸蛋详情',
    page: 'Activity/EggDetail.vue'
  }, {
    path: '/activity/redpacketdetail',
    name: '红包详情',
    page: 'Activity/RedpacketDetail.vue'
  }, {
    path: '/activity/bonusdetail',
    name: '砸蛋记录详情',
    page: 'Activity/BonusDetail.vue'
  }, {
    path: '/activity/carddetail',
    name: '卡片记录',
    page: 'Activity/CardDetail.vue'
  }, {
    path: '/activity/playermag',
    name: '活动玩家',
    page: 'Activity/PlayerMag.vue'
  }]
}]

export default getMappedRoutes(routes)